﻿using QYmall.Core.Common.Emum;
using QYmall.Core.Model.Models;
using QYmall.Core.Model.ViewModels;
using System;
using System.Collections.Generic;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;

namespace QYmall.Core.IServices
{
    /// <summary>
    /// 购物车接口
    /// </summary>
    public interface IShopCartService : IBaseService
    {
        /// <summary>
        /// 根据条件获取购物车列表
        /// </summary>
        Task<ICollection<ShopCartListDto>> GetListAsync(Expression<Func<ShopCart, bool>> funcWhere, WriteRoRead writeAndRead = WriteRoRead.Read);

        /// <summary>
        /// 添加到购物车
        /// </summary>
        Task<bool> AddAsync(ShopCartEditDto modelDto, WriteRoRead writeAndRead = WriteRoRead.Write);

        /// <summary>
        /// 更新购物车数量
        /// </summary>
        Task<bool> UpdateAsync(long id, int quantity, WriteRoRead writeAndRead = WriteRoRead.Write);

        /// <summary>
        /// 根据条件删除记录
        /// </summary>
        Task<bool> DeleteAsync(Expression<Func<ShopCart, bool>> funcWhere, WriteRoRead writeAndRead = WriteRoRead.Write);

        /// <summary>
        /// 获取商品统计和列表
        /// </summary>
        Task<ShopCartTotalDto> GetBuyListAsync(List<ShopCartEditDto> buyLlist, WriteRoRead writeAndRead = WriteRoRead.Read);

        /// <summary>
        /// 获取购物车商品总数量
        /// </summary>
        Task<int> QueryCountAsync(Expression<Func<ShopCart, bool>> funcWhere, WriteRoRead writeAndRead = WriteRoRead.Read);
    }
}
